/*
 * Filename    : Entity_Panah.java
 * Projectname : RamaShinta
 * Date        : Dec 27, 2012 , 7:26:38 PM 
 * 
 */

package com.amikomgamedev.ramashinta.entity;

import java.util.List;
import java.util.Timer;
import java.util.TimerTask;

import org.andengine.engine.handler.physics.PhysicsHandler;
import org.andengine.engine.handler.timer.ITimerCallback;
import org.andengine.engine.handler.timer.TimerHandler;
import org.andengine.entity.Entity;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.sprite.AnimatedSprite;
import org.andengine.entity.sprite.Sprite;
import org.andengine.ui.activity.BaseGameActivity;
import org.andengine.util.color.Color;

import com.amikomgamedev.ramashinta.ButtonShootCooldown;
import com.amikomgamedev.ramashinta.Utils;
import com.amikomgamedev.ramashinta.game.Game_Data;
import com.amikomgamedev.ramashinta.game.Game_Define;
import com.amikomgamedev.ramashinta.graphic.Graphic_Anim;
import com.amikomgamedev.ramashinta.graphic.Graphic_Attach;
import com.amikomgamedev.ramashinta.graphic.Graphic_Data;
import com.amikomgamedev.ramashinta.graphic.Graphic_Detach;
import com.amikomgamedev.ramashinta.graphic.Graphic_Load;
import com.amikomgamedev.ramashinta.sound.Sound_Manager;
import com.amikomgamedev.ramashinta.state.*;

public class Entity_Panah implements Game_Data, Game_Define, Graphic_Data, Graphic_Anim
{
	private BaseGameActivity	activity;
	public Rectangle			rectPanah;
	private Graphic_Detach		graphic;
	private float				posX;
	private float				posY;
	private PhysicsHandler		handler;
	private float				gerakan;
	private float				gerakan2;
	private AnimatedSprite		sprRama;
	private State_Game_Play		gp;
	private Timer				durasi;
	private boolean				setColItem;
	public Sprite				sprPanah;
	public AnimatedSprite		panahApiAnim;
	
	protected Sound_Manager		sound;

	private boolean timerReloadRama = true;
	private boolean timerReloadRahwana = true;
	private boolean timerApiRahwana = true;
	private float rotasi[] = {2.5f,2.5f};
	public boolean rotasinew[] ={false, false};
//	private State_Game_Play sgp;
	
	final static int PANAHNYA_RAMA = 0;
	final static int PANAHNYA_RAHWANA = 1;
	public int id;
	
	boolean panahApiRahwanaAktif=false;
	boolean keKanan;
	
	float moveDown = Utils.getRatioH(70);

	
	int jmlKena=0;
	
	//Luky
	public float[]  	timePoisonLQBar		= {0,0};
	public boolean[] 	PoisonLQAktif 		= {false,false};
	public int[] 		countBatasPoison	= {0,0};

	public Entity_Panah(BaseGameActivity pActivity, float x, float y, Graphic_Detach pGraphic, AnimatedSprite spr,
			boolean toRight, int id, Sound_Manager psound)

	{
		// TODO Auto-generated constructor stub
		sound=psound;
		activity = pActivity;
		rotasi[id] = 2.5f;
		posX = x;
		posY = y;
		graphic = pGraphic;
		sprRama = spr;
		keKanan = toRight;
		this.id = id;
		sprPanah = new Sprite(0, 0, Utils.getRatioW(PANAH_GAMEPLAY_WIDTH),
				Utils.getRatioH(PANAH_GAMEPLAY_HEIGHT), graphic.reg_Panah_Gameplay,
				activity.getVertexBufferObjectManager());
		panahApiAnim = new AnimatedSprite(0, 0, Utils.getRatioW(SPR_PANAH_API_WIDTH),
				Utils.getRatioH(SPR_PANAH_API_HEIGHT), graphic.reg_Anim_Panah_Api, activity.getVertexBufferObjectManager());
		graphic.spr_Gameplay_bg.attachChild(sprPanah);
		graphic.spr_Gameplay_bg.attachChild(panahApiAnim);
		panahApiAnim.animate(PANAH_API_DUR[ANIM_PANAH_API], PANAH_API_FRAME[ANIM_PANAH_API], true);
		panahApiAnim.setVisible(false);
		sprPanah.setVisible(true);
		panahApiAnim.setPosition(posX, posY);
		sprPanah.setPosition(posX, posY);
		rectPanah = new Rectangle(posX, posY, Utils.getRatioW(60), Utils.getRatioW(10),
				activity.getVertexBufferObjectManager());
		rectPanah.setColor(Color.BLACK);
		rectPanah.setX(posX);
		rectPanah.setY(posY);
		// rectPanah.setY(sprRama.getHeight() / 2);
		graphic.spr_Gameplay_bg.attachChild(rectPanah);
		rectPanah.setVisible(false);
		
		handler = new PhysicsHandler(panahApiAnim);
		panahApiAnim.registerUpdateHandler(handler);
		activity.getEngine().registerUpdateHandler(panahApiAnim);
		gerakan = panahApiAnim.getY();

		handler = new PhysicsHandler(sprPanah);
		sprPanah.registerUpdateHandler(handler);
		
		activity.getEngine().registerUpdateHandler(sprPanah);
		gerakan = sprPanah.getY();

		handler = new PhysicsHandler(rectPanah);
		rectPanah.registerUpdateHandler(handler);
		activity.getEngine().registerUpdateHandler(rectPanah);
		gerakan = rectPanah.getY();

		if(id == PANAHNYA_RAMA && Entity_Rama.panahApiAktif)
		{
			panahApiAnim.setVisible(true);
			sprPanah.setVisible(false);
			
		}

	}

	public void onUpdate(float pSecondElapsed, Entity_Shinta shinta, int id)
	{
		
		
		if (keKanan)
		{
			if(Entity_Rama.SlowPanahAktif){gerakan = Utils.getRatioW(3);}else{
			gerakan = Utils.getRatioW(10);}
			if (panahApiAnim.getX() < RES_WIDTH)
			{
				panahApiAnim.setX(panahApiAnim.getX() + gerakan);
			}
		}
		else
		{
			
			panahApiAnim.setFlippedHorizontal(true);
			if(Entity_Rahwana.SlowPanahAktif){gerakan = Utils.getRatioW(-3);}else{
				gerakan = Utils.getRatioW(-10);}
			panahApiAnim.setX(panahApiAnim.getX() + gerakan);
		}
		/////////////////////
		
		if (keKanan)
		{
			if(Entity_Rama.SlowPanahAktif){gerakan = Utils.getRatioW(3);}else{
				gerakan = Utils.getRatioW(10);}
			if (sprPanah.getX() < RES_WIDTH)
			{
				sprPanah.setX(sprPanah.getX() + gerakan);
			}
			if(Entity_Rama.MetalAktif && sprPanah.getX() > RES_WIDTH/2){
				if(rotasinew[id] == true){
					rotasi[id] = 2.5f;
				}
				rotasinew[id] = false;
				sprPanah.setRotation(rotasi[id] += 1.5f);
				sprPanah.setY(sprPanah.getY() + 5.5f);
			}
		}
		else
		{
			sprPanah.setFlippedHorizontal(true);
			if(Entity_Rahwana.SlowPanahAktif){gerakan = Utils.getRatioW(-3);}else{
				gerakan = Utils.getRatioW(-10);}
			sprPanah.setX(sprPanah.getX() + gerakan);
			if(Entity_Rahwana.MetalAktif && sprPanah.getX() < RES_WIDTH/2){
				if(rotasinew[id] == true){
					rotasi[id] = 2.5f;
				}
				rotasinew[id] = false;
				sprPanah.setRotation(rotasi[id] -= 1.5f);
				sprPanah.setY(sprPanah.getY() + 5.5f);
			}
		}
		
		/////////////////////////////////
		if (keKanan)
		{
			if(Entity_Rama.SlowPanahAktif){gerakan = Utils.getRatioW(3);}else{
				gerakan = Utils.getRatioW(10);}
			if (rectPanah.getX() < RES_WIDTH)
			{
				rectPanah.setX(rectPanah.getX() + gerakan);
			}
		}
		else
		{
			
			if(Entity_Rahwana.SlowPanahAktif){gerakan = Utils.getRatioW(-3);}else{
				gerakan = Utils.getRatioW(-10);}
			// if (rectPanah.getX() < -20){
			rectPanah.setX(rectPanah.getX() + gerakan);
			// }
		}
/////////////////////////////////
		
		
		
		for (int i = 0; i < shinta.listBenda.size(); i++)
		{
			if (rectPanah.collidesWith(shinta.listBenda.get(i).sprBenda))
			{

				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}
				sound.playSoundChoco();
				shinta.listBenda.get(i).sprBenda.detachSelf();
				shinta.listBenda.remove(i);

				if (id == PANAHNYA_RAMA)
				{


					if (Utils.isCheat())
					{
						Entity_Rama.poin +=5;
					} else
					{
						Entity_Rama.poin++;
					}
				}
				else if (id == PANAHNYA_RAHWANA)
				{
					Entity_Rahwana.poin++;
				}

			}
		}
////////////////////////////////////////////
		if (id == PANAHNYA_RAMA)
		{
			if (rectPanah.collidesWith(Entity_Rahwana.m_Mc) && !Entity_Rahwana.armorAktifRahwana)
			{
				Entity_Rahwana.stateMode=Entity_Rahwana.avoidMode;
				Entity_Rahwana.state=2;
				Entity_Rahwana.stateMode=Entity_Rahwana.normalMode;
				if(Entity_Rama.panahApiAktif){
					
				}else{
					HilangkanPanahRama();
				}
				if (Entity_Rahwana.poin > 0)
				{
					Entity_Rahwana.poin--;
				}
			}
		}
		////////////////////////////////////////
		if (id == PANAHNYA_RAHWANA)
		{
			if (rectPanah.collidesWith(Entity_Rama.m_Mc) && !Entity_Rama.armorAktif)
			{
				// rectPanah.detachSelf();
				if(Entity_Rama.panahApiAktif){
					
				}else{
					HilangkanPanah();
				}
				if (Entity_Rama.poin > 0)
				{
					Entity_Rama.poin--;
				}
			}
		}
/////////////////////////////////////////
		for (int i = 0; i < shinta.listBenda.size(); i++)
		{
			if (rectPanah.collidesWith(shinta.listBenda.get(i).sprChoco))
			{

				// rectPanah.detachSelf();

				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}
				shinta.listBenda.get(i).sprChoco.detachSelf();
				shinta.listBenda.remove(i);
				sound.playSoundChoco();
				if(id==PANAHNYA_RAMA){
				if(timerReloadRama)
				{
					graphic.spr_Stat_ChocoRama.setVisible(true);
					State_Game_Play.colItemChoco = true;
				activity.getEngine().registerUpdateHandler(new TimerHandler(4, new ITimerCallback() {
					
					@Override
					public void onTimePassed(TimerHandler pTimerHandler) {
						timerReloadRama = true;
						graphic.spr_Stat_ChocoRama.setVisible(false);
						State_Game_Play.colItemChoco = false;
					}
				}));
				timerReloadRama = false;
				}
				}
				if(id==PANAHNYA_RAHWANA){
					if(timerReloadRahwana)
					{
						graphic.spr_Stat_ChocoRahwana.setVisible(true);
						Entity_Rahwana.colItemChoco = true;
					activity.getEngine().registerUpdateHandler(new TimerHandler(4, new ITimerCallback() {
						
						@Override
						public void onTimePassed(TimerHandler pTimerHandler) {
							timerReloadRahwana = true;
							graphic.spr_Stat_ChocoRahwana.setVisible(false);
							Entity_Rahwana.colItemChoco = false;
						}
					}));
					timerReloadRahwana = false;
					}
				}
			}
		}
		//////////////////////////////////////
		for (int i = 0; i < shinta.listBenda.size(); i++)
		{
			if(rectPanah.collidesWith(shinta.listBenda.get(i).sprBoneka))
			{

//				rectPanah.detachSelf();

				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}
				sound.playSoundChoco();
				shinta.listBenda.get(i).sprBoneka.detachSelf();
				shinta.listBenda.remove(i);
				
				if(id==PANAHNYA_RAMA){
				if(Entity_Rama.timerArmor)
				{
					graphic.spr_Stat_BonekaRama.setVisible(true);
					graphic.spr_BarrierRama.setVisible(true);
					Entity_Rama.armorAktif	= true;
					Entity_Rama.timerArmor = false;
				activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
					
					@Override
					public void onTimePassed(TimerHandler pTimerHandler) {
						Entity_Rama.timerArmor = true;
						graphic.spr_Stat_BonekaRama.setVisible(false);
						graphic.spr_BarrierRama.setVisible(false);
						Entity_Rama.armorAktif = false;
					}
				}));
				}
				
				}
				if(id==PANAHNYA_RAHWANA){
					if(Entity_Rahwana.timerArmorRahwana)
					{
						graphic.spr_Stat_BonekaRahwana.setVisible(true);
						graphic.spr_BarrierRahwana.setVisible(true);
						Entity_Rahwana.armorAktifRahwana = true;
						Entity_Rahwana.timerArmorRahwana = false;
					activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
						
						@Override
						public void onTimePassed(TimerHandler pTimerHandler) {
							Entity_Rahwana.timerArmorRahwana = true;
							graphic.spr_Stat_BonekaRahwana.setVisible(false);
							graphic.spr_BarrierRahwana.setVisible(false);
							Entity_Rahwana.armorAktifRahwana = false;
						}
					}));
					}
					}

			}
		}
		////////////////////////////////////////////
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
		if(rectPanah.collidesWith(shinta.listBenda.get(i).sprRacun))
		{
			sound.playSoundRacun();
			shinta.listBenda.get(i).sprRacun.detachSelf();
			shinta.listBenda.remove(i);

			if(!Entity_Rama.panahApiAktif)
			{
				HilangkanPanahRama();
			}
			if(!panahApiRahwanaAktif)
			{
				HilangkanPanah();
			}

				if (id == PANAHNYA_RAMA)
				{
					if (Entity_Rama.poin > 0)
					{
						Entity_Rama.poin--;
					}
				}
				else if (id == PANAHNYA_RAHWANA)
				{
					if (Entity_Rahwana.poin > 0)
					{
						Entity_Rahwana.poin--;
					}
				}

			}
		}
		//////////////////////////////////////////////
		for (int i = 0; i < shinta.listBenda.size(); i++)
		{
			if (rectPanah.collidesWith(shinta.listBenda.get(i).sprApi))
			{

				// rectPanah.detachSelf();

				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}
				shinta.listBenda.get(i).sprApi.detachSelf();
				shinta.listBenda.remove(i);
				
				if(id==PANAHNYA_RAMA){
					
					if(Entity_Rama.timerApi)
					{
						graphic.spr_Stat_ApiRama.setVisible(true);
						panahApiAnim.setVisible(true);
						sprPanah.setVisible(false);
						Entity_Rama.panahApiAktif	= true;
						Entity_Rama.timerApi = false;
					activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
						
						@Override
						public void onTimePassed(TimerHandler pTimerHandler) {
							
							panahApiAnim.setVisible(false);
							graphic.spr_Stat_ApiRama.setVisible(false);
							sprPanah.setVisible(true);
							Entity_Rama.panahApiAktif = false;
							Entity_Rama.timerApi = true;
						}
					}));
					Entity_Rama.timerApi = false;
					}
					
					
					if(Entity_Rama.panahApiAktif)
					{
						panahApiAnim.setVisible(true);
						sprPanah.setVisible(false);
						
					}
					}
				
				
					if(id==PANAHNYA_RAHWANA){
						if(timerApiRahwana)
						{
							graphic.spr_Stat_ApiRahwana.setVisible(true);
							panahApiAnim.setVisible(true);
							sprPanah.setVisible(false);
							panahApiRahwanaAktif = true;
							timerApiRahwana = false;
						activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
							
							@Override
							public void onTimePassed(TimerHandler pTimerHandler) {
								graphic.spr_Stat_ApiRahwana.setVisible(false);
								panahApiAnim.setVisible(false);
								sprPanah.setVisible(true);
								timerApiRahwana = true;
								panahApiRahwanaAktif = false;
							}
						}));
						timerApiRahwana = false;
						}
						}

			}
		}
///////////////////////////////////////
		for (int i = 0; i < shinta.listBenda.size(); i++)
		{
			if (rectPanah.collidesWith(shinta.listBenda.get(i).sprKayu))
			{
				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}
				
				
				if (id == PANAHNYA_RAMA | id == PANAHNYA_RAHWANA)
				{
					jmlKena++;
					if (jmlKena == 2)
					{
						sound.playSoundHit();
						shinta.listBenda.get(i).sprKayu.detachSelf();
						shinta.listBenda.remove(i);
						jmlKena = 0;
					}
				}
				// rectPanah.detachSelf();

			}

		}
		/////////////////////////////////////////
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
		if(rectPanah.collidesWith(shinta.listBenda.get(i).sprPoisonLiquid))
		{
			
			shinta.listBenda.get(i).sprPoisonLiquid.detachSelf();
			shinta.listBenda.remove(i);

			if(!Entity_Rama.panahApiAktif)
			{
				HilangkanPanahRama();
			}
			if(!panahApiRahwanaAktif)
			{
				HilangkanPanah();
			}	
					PoisonLQAktif[id] = true;
					timePoisonLQBar[id] = 0; 
					countBatasPoison[id] = 0;
					graphic.spr_Stat_PoisonLQ[id].setVisible(true);

			}
		
		
		
		}
		///////////////////////////////
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
			if(rectPanah.collidesWith(shinta.listBenda.get(i).sprBeeHive))
			{
				
				shinta.listBenda.get(i).sprBeeHive.detachSelf();
				shinta.listBenda.remove(i);
				if(!Entity_Rama.panahApiAktif)
				{
					HilangkanPanahRama();
				}
				if(!panahApiRahwanaAktif)
				{
					HilangkanPanah();
				}	
				
				
				if(id == PANAHNYA_RAMA){
					if(Entity_Rama.beeHive == false){
						Entity_Rama.beeHive = true;
						graphic.spr_Stat_BeeHive[PANAHNYA_RAMA].setVisible(true);
					}
					
				activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
					@Override
					public void onTimePassed(TimerHandler pTimerHandler) {
						if(Entity_Rama.beeHive == true){
							Entity_Rama.beeHive = false;
							graphic.spr_Stat_BeeHive[PANAHNYA_RAMA].setVisible(false);
						}
					}
				}));
				}else{
					if(Entity_Rahwana.beeHive == false){
						Entity_Rahwana.beeHive = true;
						graphic.spr_Stat_BeeHive[PANAHNYA_RAHWANA].setVisible(true);
					}
					activity.getEngine().registerUpdateHandler(new TimerHandler(10, new ITimerCallback() {
						@Override
						public void onTimePassed(TimerHandler pTimerHandler) {
							if(Entity_Rahwana.beeHive == true){
								Entity_Rahwana.beeHive = false;
								graphic.spr_Stat_BeeHive[PANAHNYA_RAHWANA].setVisible(false);
							}
						}
					}));
				}
				
				
				
			}
		}
		
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
		if(rectPanah.collidesWith(shinta.listBenda.get(i).sprMetal))
		{
			
			shinta.listBenda.get(i).sprMetal.detachSelf();
			shinta.listBenda.remove(i);

			if(!Entity_Rama.panahApiAktif)
			{
				HilangkanPanahRama();
			}
			if(!panahApiRahwanaAktif)
			{
				HilangkanPanah();
			}
			if(id == PANAHNYA_RAMA){
			final int ids = id;
			Entity_Rama.MetalAktif = true;
			activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
				@Override
				public void onTimePassed(TimerHandler pTimerHandler) {
					Entity_Rama.MetalAktif = false;
					rotasi[ids] = 2.5f;
				}
			}));
			}else{
				final int ids = id;
				Entity_Rahwana.MetalAktif = true;
				activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
					@Override
					public void onTimePassed(TimerHandler pTimerHandler){
						Entity_Rahwana.MetalAktif = false;
						rotasi[ids] = 2.5f;
					}
				}));
				
			}
			
					
			}
		
		
		
		}
		////////////////////////////////
		for(int i=0; i<PoisonLQAktif.length; i++){
		if(PoisonLQAktif[i] && (int)((timePoisonLQBar[i] += pSecondElapsed) % 60) > 1){
			if(countBatasPoison[i] < 3){
			if(i == 0){
			if (Entity_Rama.poin > 0){
			sound.playSoundRacun();
			Entity_Rama.poin--;
			}}else{
			if (Entity_Rahwana.poin > 0)
			{
				Entity_Rahwana.poin--;
			}}
			
			countBatasPoison[i]++;
			timePoisonLQBar[i] = 0;
			}else{
				PoisonLQAktif[i] = false;
				graphic.spr_Stat_PoisonLQ[i].setVisible(false);
			}
		}}
	///////////////////////////////////////////////////////////////			
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
		if(rectPanah.collidesWith(shinta.listBenda.get(i).sprBorgol))
		{
			
			shinta.listBenda.get(i).sprBorgol.detachSelf();
			shinta.listBenda.remove(i);

			if(!Entity_Rama.panahApiAktif)
			{
				HilangkanPanahRama();
			}
			if(!panahApiRahwanaAktif)
			{
				HilangkanPanah();
			}
			
			if(id == PANAHNYA_RAMA){
			Entity_Rama.SlowMoveAktif = true;
			activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
				@Override
				public void onTimePassed(TimerHandler pTimerHandler) {
					Entity_Rama.SlowMoveAktif = false;
				}
			}));
			}else{
				final int ids = id;
				Entity_Rahwana.SlowMoveAktif = true;
				activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
					@Override
					public void onTimePassed(TimerHandler pTimerHandler){
						Entity_Rahwana.SlowMoveAktif = false;
					}
				}));
				
			}
			
					
			}
		
		
		
		}
		////////////////////////////////////////////////
		for(int i = 0; i < shinta.listBenda.size(); i++)
		{
		if(rectPanah.collidesWith(shinta.listBenda.get(i).sprDumbell))
		{
			
			shinta.listBenda.get(i).sprDumbell.detachSelf();
			shinta.listBenda.remove(i);

			if(!Entity_Rama.panahApiAktif)
			{
				HilangkanPanahRama();
			}
			if(!panahApiRahwanaAktif)
			{
				HilangkanPanah();
			}
			
			if(id == PANAHNYA_RAMA){
			Entity_Rama.SlowPanahAktif = true;
			activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
				@Override
				public void onTimePassed(TimerHandler pTimerHandler) {
					Entity_Rama.SlowPanahAktif  = false;
				}
			}));
			}else{
				Entity_Rahwana.SlowPanahAktif  = true;
				activity.getEngine().registerUpdateHandler(new TimerHandler(1000, new ITimerCallback() {
					@Override
					public void onTimePassed(TimerHandler pTimerHandler){
						Entity_Rahwana.SlowPanahAktif  = false;
					}
				}));
				
			}
			
					
			}
		
		
		
		}
		/////////////////////////////////////////////////
	}

	
	void HilangkanPanah()
	{
		if (id == PANAHNYA_RAHWANA)
		{
			rectPanah.setX(-rectPanah.getWidth());
			sprPanah.setX(-sprPanah.getWidth());
			panahApiAnim.setX(-panahApiAnim.getWidth());
		}
	}

	void HilangkanPanahRama()
	{
		if (id == PANAHNYA_RAMA)
		{
			rectPanah.setX(-rectPanah.getHeight());
			rectPanah.setY(Utils.getRatio(-600));
			sprPanah.setX(-sprPanah.getHeight());
			sprPanah.setY(Utils.getRatio(-600));
			panahApiAnim.setX(-panahApiAnim.getHeight());
			panahApiAnim.setY(Utils.getRatio(-600));
		}
	}

	public float getPosX()
	{
		return rectPanah.getX();
	}
}
